(defun ToList (col / rtlist)	;from a post on TheSwamp.org http://www.theswamp.org/index.php?topic=36908.msg418922#msg418922
 (defun	VariantValue (value)
   (cond
     ((eq 'variant (type value))
      (VariantValue (vlax-variant-value value))
     )
     ((eq 'safearray (type value))
      (mapcar 'VariantValue (vlax-safearray->list value))
     )
     (value)
   )
 )
  (cond	;;We have a list
	((listp col) col)
	;;We have a string
	((eq 'STR (type col)) (vl-string->list col))
	;;We have a selection set
	((eq 'PICKSET (type col))
	 (vl-remove-if
	   'null
	   (vl-remove-if-not
	     (function (lambda (e) (= 'ENAME (type e))))
	     (apply 'append (ssnamex col))
	   )
	 )
	)
	;;We have a variant array
	((eq 'variant (type col))
	 (tolist (variantvalue col))
	)
	;;We have a table
	((and (eq 'VLA-OBJECT (type col)) (wcmatch (vla-get-objectname col) "*Table"))
	 (vlax-for item col (setq rtlist (cons item rtlist)))
	 (reverse rtlist)
	 )
	;;We have a dictionary
	((and (eq 'VLA-OBJECT (type col)) (= "AcDbDictionary" (vla-get-objectname col)))
	 (vlax-for entry col
	     (if (vlax-property-available-p entry 'name)
		      (cons (vla-get-name entry) entry)
		      ;;I considered using the objectname instead of "UnNamed"
		      (cons "UnNamed" entry)
		      )
	     )
	   )
	;;We have a generic collection object
	((and (eq 'VLA-OBJECT (type col))(vlax-property-available-p col 'count))
	 (vlax-for item col (setq rtlist (cons item rtlist)))
	 (reverse rtlist)
	)
	(T
	 (if (eq 'VLA-OBJECT (type col))
	   (strcat "Error|Unhandled collection type:" (vla-get-objectname col))
	   (strcat "Error|Unhandled col argument:" (vl-prin1-to-string (type col)) ":" (vl-prin1-to-string col))
	   )
	 )
  )
)
